package demo8;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.sql.Connection;

public class test {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Config.class);
        Person bean = context.getBean(Person.class);
        System.out.println(bean);
        DBUtil bean1 = context.getBean(DBUtil.class);
        System.out.println(bean1);
        try {
            Connection connection = bean1.getConnection();
            System.out.println(connection);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }


    }
}
